const { Sequelize, Model } = require('sequelize')
const { sequelize } = require('../../core/db')

class SitePage extends Model {}

SitePage.init({
  id: {
    type: Sequelize.INTEGER,
    autoIncrement: true,
    primaryKey: true
  },
  title: { 
    type: Sequelize.STRING(20),
    unique: true
  },
  content: Sequelize.STRING(6000),
  orderNum: {
    type: Sequelize.INTEGER,
    defaultValue: 1
  }
}, {
  sequelize
})

SitePage.sync({force: true}).then(() => {
  SitePage.create({
    title: '企业荣誉',
    content: '企业荣誉',
    orderNum: 1
  })
})

module.exports = SitePage